package com.zhousb.deviceManager.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhousb.deviceManager.common.PageRequest;
import com.zhousb.deviceManager.common.R;
import com.zhousb.deviceManager.common.ResponseResult;
import com.zhousb.deviceManager.model.bo.TransferSubmitBo;
import com.zhousb.deviceManager.model.so.TransferRecordSo;
import com.zhousb.deviceManager.service.TransferRecordService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhousb
 * @date 2024/11/1 14:52
 * @description
 */
@RestController
@RequestMapping("/transfer")
public class TransferRecordController {
    @Resource
    private TransferRecordService transferRecordService;

    @PostMapping("/page")
    public ResponseResult<?> page(@RequestBody PageRequest<TransferRecordSo> so) {
        return R.success(transferRecordService.page(new Page<>(so.getCurrent(), so.getSize()), so.getQuery()));
    }

    @PostMapping("/submit")
    public ResponseResult<?> submit(@RequestBody TransferSubmitBo bo) {
        return R.success(transferRecordService.submit(bo));
    }
}
